<br>
<div class="layui-col-md12"><blockquote class="layui-elem-quote layui-quote-nm"><a href="" target="_blank"></a></blockquote></div>

<div>
    <audio src="order.wav" id="order_play" autoplay="autoplay" ></audio>
    <audio src="withdraw.wav" id="withdraw_play" autoplay="autoplay" ></audio>
</div>

<script type="text/javascript">
    $(document).ready(function(){

        //定时请求
         get_order_list()

    })

function get_order_list(){
   $.ajax({
       dataType : "json",
       type : 'get',
       url : "/adminabc/website/get_order_notice_config",
       success : function(data) {
           // layer.msg(data.msg);
           var order_notice_status = data.data.order_notice_status
           var order_notice_times = data.data.order_notice_times
           var order_notice_interval = data.data.order_notice_interval
           var ajax_interval = data.data.ajax_interval
           var notice_order = data.notice_order
           var notice_withdraw = data.notice_withdraw

            var order_url = window.location.protocol + "//" + window.location.hostname + '/order.wav'

            var withdraw_url = window.location.protocol + "//" + window.location.hostname + '/withdraw.wav'

            // $('#order_play')[0].pause();

           console.log(order_notice_status)
           if (order_notice_status != 1) return;
            console.log(ajax_interval)

            var t = setInterval(function(){

                $.ajax({
                    dataType : "json",
                    type : 'get',
                    url : "/adminabc/website/get_order_notice_config",
                    success : function(res) {

                        order_notice_times = res.data.order_notice_times
                        order_notice_interval = res.data.order_notice_interval
                        notice_order = res.notice_order
                        notice_withdraw = res.notice_withdraw
                        var i = 1;
                        var j = 1;
                        console.log(res)
                        console.log('notice_withdraw',notice_withdraw)

                        //提现提醒
                        var withdraw_notice = $.cookie('notice_status') // 获取cookie 有提醒 就不重复提醒.
                        console.log('withdraw_notice',withdraw_notice)
                        var date = new Date();
                        date.setTime(date.getTime()+ order_notice_interval * order_notice_times *1000);

                        console.log('date',date)
                        if (withdraw_notice === undefined || withdraw_notice == 0){
                            if (notice_withdraw == 1){
                                $.cookie('notice_status', i,{ expires: date })
                                var w = setInterval(function(){
                                    console.log('提现开始提醒'+i)

                                    console.log(i)
                                    $('#order_play').attr('src',withdraw_url);
                                    $('#order_play')[0].play();

                                    if (order_notice_times <= i){
                                        // $.cookie('notice_status', 0)
                                        clearTimeout(w)
                                    }
                                    i++
                                }, order_notice_interval * 1000)
                            }
                        }


                        //订单提醒
                        var order_notice = $.cookie('order_notice_status') // 获取cookie 有提醒 就不重复提醒.
                        console.log("order_notice",order_notice)
                        console.log("notice_order",notice_order)
                        if (order_notice === undefined || order_notice == 0){
                            if (notice_order == 1){
                                //设置cookie
                                $.cookie('order_notice_status', j,{ expires: date })
                                var order = setInterval(function(){
                                    console.log('订单开始提醒'+j)
                                    $('#order_play').attr('src',order_url);
                                    $('#order_play')[0].play();
                                    if (order_notice_times <= j){
                                        // $.cookie('order_notice_status', 0)
                                        clearTimeout(order)
                                    }
                                    j++
                                }, order_notice_interval * 1000)
                                //开始提醒

                            }
                        }
                    }})
                // clearTimeout(t)
            }, ajax_interval * 1000)



       }
   });
}
</script>